package com.mz.ozy.mvp.model;

import android.content.Context;

import com.mz.ozy.constants.Constants;
import com.mz.ozy.net.RetrofitUtils;
import com.mz.ozy.utils.JsonUtils;
import com.mz.ozy.utils.MD5Util;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class TransferModel {


    public Observable<ResponseBody> getTransferInfo(Context context, String type) {
        Map<String, String> maps = new HashMap<>();
        maps.put("type", type);
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10015, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }


    public Observable<ResponseBody> obtainTransfer(Context context, String payType, String receivingAccount, String amt, String pwd) {
        Map<String, String> maps = new HashMap<>();
        maps.put("type", payType);
        maps.put("receivingAccount", receivingAccount);
        maps.put("amt", amt);
        maps.put("pwd", MD5Util.getMD5String(pwd));
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10016, JsonUtils.requestJsonDate(maps), Constants.tokenId);
    }


    public Observable<ResponseBody> getUserName(Context context, String invitationCode) {
        Map<String, String> maps = new HashMap<>();
        maps.put("invitationCode", invitationCode);
        return RetrofitUtils.getApiService(context).post(Constants.TransCode.TransCode10046, JsonUtils.requestJsonDate(maps), Constants.tokenId);

    }
}
